<template>
  <div class="c-p">
    <div class="c-ph24 c-flex-row bgTop theme-bg c-aligni-center">
      <div class="c-pl24 c-flex-grow1 c-w0 c-aligni-center">
        <div v-if="order && order.prodType==7 && order.prodEnrollInfo && order.prodEnrollInfo.enrollRefundStatus == 1 && order.prodEnrollInfo.refundReason == 1" class="c-fs28 c-fc-white">签到退款</div>
        <div v-else class="c-fs28 c-fc-white">{{mapStatus[status]}}</div>
      </div>
    </div>
    <div v-if="orderInfo[0].prodType == cfrom.collocationBuy" class="c-pv24 c-ph24 c-flex-row c-bg-white c-aligni-stretch c-mb12">
      <div class="c-ww180 c-maxh120 c-br16 c-text-hidden c-p">
        <img class="c-ww180 c-br16 imgCloseBig" :src="$addXossFilter(orderInfo[0].avatar || require('@/assets/defult270.png'))" alt="" />
        <span class="c-fc-white c-fs18 c-translucent-balck50 c-br-tl16 c-pa c-p-b0 c-p-r0 c-ph12 c-hh28 c-lh28">{{order.comboType == 1 ? '自选套餐' : '固定套餐'}}</span>
      </div>
      <div class="c-w0 c-flex-grow1 c-flex-column c-justify-sb c-ml12">
        <div class="c-fs28 c-fc-xblack c-fw600 c-text-ellipsis2 c-flex-shrink0">{{orderInfo[0].prodName}}</div>
        <div v-if="order.comboType == 2 && order.specType == 2" class="c-fs24 c-fc-gray c-text-ellipsis1">选择规格：{{order.specName}}</div>
      </div>
    </div>
    <section class="c-bg-white c-ph24" v-if="orderInfo && orderInfo.length > 0">
      <div class="c-flex-row c-pv20" v-if="orderInfo[0].prodType != cfrom.collocationBuy" @click="clickOrderItem">
        <div class="c-ww180 c-hh120 c-text-hidden">
          <div v-if="order.prodType == cfrom.datum" class="c-w100 c-center">
            <img class="c-w100 imgCloseBig" :src="$addXossFilter(order.avatar, require('@/assets/i/wap/datum/datumsDefault.png'))" alt="" />
          </div>
          <img
            v-else-if="order.prodType == cfrom.agentApply || order.prodType == cfrom.partnerApply || order.prodType == cfrom.branchApply || order.prodType == cfrom.cooApply || order.prodType == cfrom.agencyApply || order.prodType == cfrom.agent6Apply || order.prodType == cfrom.agent7Apply || order.prodType == cfrom.agent8Apply || order.prodType == cfrom.agent9Apply"
            v-lazy="(order.avatar == ''|| order.avatar == null) ? require('../../../assets/agentApply.png') : order.avatar" class="c-w100 imgCloseBig" />
          <vip-custom-img :cover="order.vipInfo.cover" :imgClass="'imgCloseBig c-br10'" :fontClass="{
            boxStyle: 'c-pv20 c-pl12',
            name: 'c-fs24 c-text-ellipsis1 c-fw-b',
            duration: 'c-fs18'}" :content="{name: order.vipInfo.name, duration: order.vipInfo.duration, durationType: order.vipInfo.durationType}" v-else-if="order.vipInfo && order.vipInfo.cover" />
          <img v-else-if='order.prodType == cfrom.exam' v-lazy="(order.avatar==''||order.avatar==null)?require('../../../assets/examination_defult.png'):order.avatar" :key="order.avatar"
            class="c-w100 imgCloseBig c-br10" />
          <img v-else-if="order.prodType == cfrom.shareholder" :src="require('../../../assets/shareholderApply.png')" class="c-w100 imgCloseBig c-br10" />
          <img v-else-if="order.prodType == cfrom.shareholderPayVoucher" :src="require('../../../assets/shareholderPayVoucher.png')" class="c-w100 imgCloseBig c-br10" />
          <img v-else :src="order.avatar || require('../../../assets/defult270.png')" class="c-w100 imgCloseBig c-br10" />
        </div>
        <div class="c-pl20 c-flex-grow1 c-w0 c-hh120 c-flex-column c-justify-sb">
          <div class="c-flex-row">
            <div class="c-maxw316">
              <div class="c-fs24 c-fw-b c-text-ellipsis1 c-lh32">{{orderInfo[0].prodName}}</div>
              <span
                class="c-pt12 c-fs20 c-fc-gray c-flex-row">{{((order.tags & 4) == 4) && ((order.tags & 8) == 8) ? '买赠' : ''}}{{(order.tags & 2) == 2 ? collageMap[order.prodType] : (order.tags & 4096) == 4096 ? bargainMap[order.prodType] : (order.tags & 8) == 8 ? salesMap[order.prodType] : (order.tags & 4194304) == 4194304 ? '推荐有礼' + typeMap[order.prodType] : ((order.tags & 524288) == 524288 ? '实物带货' + typeMap[order.prodType] : (order.tags & 1048576) == 1048576 ? groupPurchaseMap[order.prodType] : order.prodType == cfrom.activity ? '活动购票' :'购买' + typeMap[order.prodType])}}{{order.prodType ? '' : order.desc}}</span>
              <div v-if="order.spec" class="c-pt8 c-fs20 c-fc-gray c-flex-row">有效期：{{order.spec.tit}}</div>
            </div>
            <div class="c-w0 c-flex-grow1 c-textAlign-r">
              <div class="c-fs24 c-fc-xblack c-ws-n">{{'￥' | iosPriceFilter}}{{orderInfo[0].prodPrice}}</div>
              <div class="c-fs20 c-fc-gray c-mt12">x {{orderInfo[0].quantity}}</div>
            </div>
          </div>
        </div>
      </div>
      <template v-else>
        <div class="c-flex-row c-justify-sb c-aligni-center c-pt24 c-pb12">
          <div class="c-fs24 c-fc-sblack c-fw600">套餐商品</div>
          <div @click="showCollocationProds = !showCollocationProds;" class="iconfont c-fs24 c-fc-gray">{{showCollocationProds ? '&#xe6a9;' : '&#xe6ab;'}}</div>
        </div>
        <!-- <div class="c-fs30 c-fc-xblack c-fw600 c-bg-white c-ph24 c-pt30 c-pb16"><span class="c-fs18 theme-fc theme-bd1 c-inlineblack c-ww96 c-pv2 c-textAlign-c theme-bg-10 c-br4 c-vcAlign-top c-mr16">{{order.comboType == 1 ? '自选套餐' : '固定套餐'}}</span>{{orderInfo[0].prodName}}</div> -->
        <section v-show="showCollocationProds" class="c-flex-row c-bg-white c-pv16" @click="clickCollocationItem(item)" v-for="(item, index) in collocationArr" :key="index">
          <div class="c-text-hidden c-flex-shrink0 c-p c-br6 c-ww180 c-hh120">
            <img class="c-w100 imgCloseBig" :src="$addXossFilter(item.prodType == 5000 && (status == 0 ? item.cover : item.avatar) ? (JSON.parse(status == 0 ? item.cover : item.avatar)[0]) : (status == 0 ? item.cover : item.avatar), require('@/assets/defult270.png'))" alt="" />
            <!-- <span class="c-pa c-p-b0 c-p-r0 c-br-tl4 c-fs16 c-fc-white c-ph4 c-hh22 c-flex-row c-flex-center c-translucent-balck60">{{ PROD_TYPE_MAP[item.prodType] }}</span> -->
          </div>
          <div class="c-flex-column c-flex-grow1 c-w0 c-pl20">
            <div class="c-fs28 c-text-ellipsis2 c-wordBreakAll c-lh32">
              <!-- <span class="c-fs18 theme-fc theme-bd1 c-inlineblack c-ww72 c-hh28 c-lh30 c-textAlign-c theme-bg-10 c-br4 vcAlign-text-top c-mr8">搭配购</span> -->
              <!-- <span class="c-fs16 theme-bg c-fc-white c-mr10 c-textAlign-c c-br4 c-lh c-pv4 c-ph4 c-inlineblack c-vcAlign-middle">搭配购</span> -->
              <span>{{ item.prodName }}</span>
            </div>
            <div class="c-fs20 c-fc-gray c-pt30 c-flex-row c-aligni-center c-justify-sb">
              <span>{{typeMap[item.prodType == 5 ? (item.courseType != null ? ('11' + item.courseType) : item.subProdType) : item.prodType]}}搭配购</span>
              <span class="c-fs22">x {{item.prodNum}}</span>
            </div>
            <div class="c-pt24 c-flex-row c-justify-end" v-if="item.status == -6">
              <span class="c-fs20 c-fc-xmlred">退款成功：{{'￥' | iosPriceFilter}}{{ item.refundAmount }}</span>
            </div>
            <!-- <div class="c-fs26 theme-fc c-pt30 c-flex-row c-aligni-center c-justify-sb">
              <span class="c-fc-xblack"><span class="c-fs18">{{ "￥" | iosPriceFilter }}</span>{{ Number(item.price).toFixed(2) }}</span>
              <span><span class="c-fs24">优惠价：</span><span class="c-fs18">{{ "￥" | iosPriceFilter }}</span>{{ Number(item.payPrice).toFixed(2) }}</span>
            </div> -->
          </div>
        </section>
      </template>
      <div class="c-pt24 c-bd-t1-f6 c-bd-b1-f6">
        <div v-if="!(orderInfo[0].prodType == cfrom.collocationBuy && order.isShowPrice == 0)" class="c-pb24 c-flex-row c-justify-sb c-aligni-center c-fs20">
          <span class="c-flex-grow1 c-w0 c-fc-sblack">商品总价</span>
          <span class="c-fc-xblack">{{'￥' | iosPriceFilter}}{{orderInfo[0].prodType == cfrom.collocationBuy ? Number(collocationTotalPrice).toFixed(2) : orderInfo[0].prodType == cfrom.activity ? Number(orderInfo[0].prodPrice * orderInfo[0].quantity) : orderInfo[0].prodPrice }}</span>
        </div>
        <div class="c-flex-row c-pb24 c-justify-sb c-aligni-center c-fs20" v-if="Number(order.chainDiscountMoney) > 0 && order.isChainOrder">
          <span class="c-flex-grow1 c-w0 c-fc-sblack">{{order.isReorder == 1 ? '复购' : '购买'}}优惠</span>
          <span class="c-fc-xblack">-{{'￥' | iosPriceFilter}}{{order.chainDiscountMoney}}</span>
        </div>
        <div class="c-flex-row c-pb24 c-justify-sb c-aligni-center c-fs20" v-if="Number(order.deductedCouponMoney) > 0">
          <span class="c-flex-grow1 c-w0 c-fc-sblack">优惠券抵扣</span>
          <span class="c-fc-xblack">-{{'￥' | iosPriceFilter}}{{order.deductedCouponMoney}}</span>
        </div>
        <div class="c-flex-row c-pb24 c-justify-sb c-aligni-center c-fs20" v-if="Number(order.deductedMoney) > 0">
          <span class="c-flex-grow1 c-w0 c-fc-sblack">{{customPointName}}抵扣</span>
          <span class="c-fc-xblack">-{{'￥' | iosPriceFilter}}{{order.deductedMoney}}</span>
        </div>
        <div class="c-flex-row c-pb24 c-justify-sb c-aligni-center c-fs22" v-if="Number(order.discount) != 100">
          <span class="c-flex-grow1 c-w0 c-fc-sblack">会员折扣</span>
          <span class="c-fc-xblack">{{formatDecimal(order.discount * 0.1, 2)}}折</span>
        </div>
        <div class="c-flex-row c-pb24 c-justify-sb c-aligni-center c-fs22" v-if="order.tags == 2">
          <span class="c-flex-grow1 c-w0 c-fc-sblack">拼团价</span>
          <span class="c-fc-xblack">{{'￥' | iosPriceFilter}}{{order.payMoney}}</span>
        </div>
        <div class="c-flex-row c-pb24 c-justify-sb c-aligni-center c-fs22" v-if="order.tags == 4096">
          <span class="c-flex-grow1 c-w0 c-fc-sblack">砍价</span>
          <span class="c-fc-xblack">{{'￥' | iosPriceFilter}}{{order.payMoney}}</span>
        </div>
        <div class="c-flex-row c-pb24 c-justify-sb c-aligni-center c-fs22" v-if="order.tags == 8">
          <span class="c-flex-grow1 c-w0 c-fc-sblack">限时购</span>
          <span class="c-fc-xblack">{{'￥' | iosPriceFilter}}{{order.payMoney}}</span>
        </div>
        <div class="c-flex-row c-pb24 c-justify-sb c-aligni-center c-fs20" v-if="orderInfo[0].prodType == cfrom.collocationBuy && Number(collocationTotalPrice - order.payMoney) > 0 && order.isShowPrice != 0">
          <span class="c-flex-grow1 c-w0 c-fc-sblack">优惠金额</span>
          <span class="c-fc-xblack">{{'￥' | iosPriceFilter}}{{Number(collocationTotalPrice - order.payMoney).toFixed(2)}}</span>
        </div>
        <div v-if="orderInfo[0].recDeductedMoney" class="c-flex-row c-pb24 c-justify-sb c-aligni-center c-fs22">
          <span class="c-flex-grow1 c-w0 c-fc-sblack">推荐优惠金额</span>
          <span class="c-fc-xblack">-{{'￥' | iosPriceFilter}}{{orderInfo[0].recDeductedMoney}}</span>
        </div>
        <div :class="order.paymentMethod == 17 ? '' : 'c-pb30'" class="c-flex-row c-aligni-center c-justify-end c-fs20">
          <div v-if="order.paymentMethod == 17" class="c-ww92 c-hh28 c-flex-row c-flex-center c-br8 c-fc-white c-fs20 c-mr12 bg-deepGreen">先学后付</div>
          <div>实付款：</div>
          <div class="theme-fc c-fw400 c-flex-row c-aligni-center">{{'￥' | iosPriceFilter}}<div v-html="filterMoney"></div>
          </div>
        </div>
        <div v-if="order.paymentMethod == 17" class="c-fc-gray c-fs20 c-textAlign-r c-mt20 c-pb30">学完一个环节课程后，自动支付费用</div>
      </div>
      <div class="c-pt30 c-pb20" v-if="order.paymentMethod == 17 && order.plan_details && order.plan_details.length > 0">
        <div><span class="c-fc-xblack c-fw600 c-fs26">账单记录</span><span class="c-fs24 c-fc-gray">（完成{{wxCreditPayTimes}}次，剩余{{wxCreditPayLastTimes}}次）</span></div>
        <div class="c-pl12 c-mt40">
          <div :class="item.service_order_state == 'DONE' ? 'bd-l2-theme' : 'bd-l2-sgray'" class="c-hh140 c-pl40 c-p" v-for="(item, index) in order.plan_details" :key="index">
            <div class="c-fs22 c-fc-sblack">第{{item.plan_detail_no}}次</div>
            <div v-if="item.service_order_state == 'STOP'" class="c-fs24 c-fc-xblack c-mt16">已退单</div>
            <div v-else class="c-fs24 c-fc-xblack c-mt16">{{item.service_order_state == 'DONE' ? '已扣费' : '预计扣费'}} - {{'￥' | iosPriceFilter}}{{item.amount}}</div>
            <div :class="item.service_order_state == 'DONE' || item.service_order_state == 'DOING' ? 'theme-bg' : 'c-bg-mgray'" class="c-ww24 c-hh24 c-br12 c-pa c-flex-row c-flex-center p-14 c-p-t0">
              <div class="c-ww8 c-hh8 c-br8 c-bg-white"></div>
            </div>
          </div>
        </div>
      </div>
      <div
        class="c-hh72 c-flex-row c-fs22 c-bg-white c-flex-center"
        v-if="(order.tags & 1048576) == 1048576 && status != 0">
        <div @click="goGroupPurchaseTicket(order.orderId)" class="c-fs22 c-ww148 c-hh50 c-flex-row c-flex-center theme-bg-10 theme-fc c-br25">
          我的票券</div>
      </div>
      <!-- 联系客服 -->
      <custom-service-tmp :position="2"></custom-service-tmp>
    </section>
    <section v-if="isShowGift()" @click="popGiftModal" class="c-mt12 c-bg-white c-flex-row c-ph24 c-fs20 c-aligni-center c-hh80">
      <div class="c-fs24 c-fc-xblack c-fw600">赠品</div>
      <div class="c-w0 c-flex-grow1 c-flex-row c-aligni-center c-ml24">
        <div class="c-fs16 theme-fc c-hh24 c-lh26 c-ph8 theme-bg-10 c-br4">礼包</div>
        <div class="c-fs22 c-fc-xblack c-w0 c-flex-grow1 c-ml20">内含{{order.giftRelates.length}}个商品</div>
      </div>
      <div v-if="order.prodType == 7" class="c-flex-row c-aligni-center theme-fc c-fs24">
        <span>领取礼包</span>
        <span class="iconfont c-fs14 c-pt2">&#xe635;</span>
      </div>
      <div v-else class="iconfont c-fs40 c-fc-gray">&#xe7be;</div>
    </section>
    <!-- 推荐有礼礼包 -->
    <div v-if="(order.tags & 4194304) == 4194304 && order.isBeTaskReward && status == 1" @click="openReCommendPresent" class="c-mt12 c-bg-white c-flex-row c-ph24 c-fs20 c-justify-sb c-aligni-center c-pv12">
      <div class="c-fs24 c-fc-xblack c-fw600">礼包</div>
      <div class="iconfont c-fs40 c-fc-gray">&#xe7be;</div>
    </div>
    <section class="c-mt12 c-bg-white c-flex-column c-ph24 c-fs20">
      <div class="c-pt34 c-pb28 c-flex-row c-justify-sb c-aligni-center">
        <span class="c-flex-grow1 c-w0 c-fc-sblack">订单编号</span>
        <div class="c-fc-xblack">{{order.orderNo}}<span class="c-ph20 c-pv8 c-fs18 c-fc-xblack c-ml20 c-br20 c-bg-f2" @click="copyText(order.orderNo)">复制</span></div>
      </div>
      <div class="c-pb24 c-flex-row c-justify-sb c-aligni-center" v-if="order.addPoint > 0">
        <span class="c-flex-grow1 c-w0 c-fc-sblack">获得{{ customPointName }}</span>
        <span class="c-fc-xblack">{{order.addPoint}}{{customPointName}}</span>
      </div>
      <div class="c-pb24 c-flex-row c-justify-sb c-aligni-center">
        <span class="c-flex-grow1 c-w0 c-fc-sblack">创建时间</span>
        <span class="c-fc-xblack">{{order.createdAt}}</span>
      </div>
      <div class="c-pb24 c-flex-row c-justify-sb c-aligni-center" v-if="order.payAt">
        <span class="c-flex-grow1 c-w0 c-fc-sblack">付款时间</span>
        <span class="c-fc-xblack">{{order.payAt}}</span>
      </div>
      <div class="c-pb24 c-flex-row c-justify-sb c-aligni-center" v-if="order.paymentMethod == 17">
        <span class="c-flex-grow1 c-w0 c-fc-sblack">付款方式</span>
        <span class="c-fc-xblack">先学后付</span>
      </div>
    </section>
    <section class="c-mt12 c-bg-white c-ph24 c-pv24 c-flex-row c-aligni-center c-justify-center" v-if="payAward != null && (order.tags & 1048576) != 1048576">
      <div class="c-w100" @click="handleClickpayAward()">
        <!-- awardType:1优惠卷2商城3参与活动 -->
        <template v-if="payAward.awardType == 1">
          <img src="https://kposshzcdn.ckjr001.com/admin/material/9_material_admin/image/assets/i/wap/payPolitely/coupon.png" alt="">
        </template>
        <template v-else-if="payAward.awardType == 2">
          <img src="https://kposshzcdn.ckjr001.com/admin/material/9_material_admin/image/assets/i/wap/payPolitely/gift.png" alt="">
        </template>
        <template v-else>
          <img src="https://kposshzcdn.ckjr001.com/admin/material/9_material_admin/image/assets/i/wap/payPolitely/activity.png" alt="">
        </template>
      </div>
    </section>
    <section class="c-pv20 c-flex-row c-aligni-center c-flexw-wrap c-fs20 theme-fc" v-if="protocolInfo">
      <span class="c-fc-gray c-pl20">已阅读并同意</span>
      <span @click.stop="clickProtocol(item)" v-for="(item, index) in protocolInfo" :key="index">《{{item.name}}》</span>
    </section>
    <coupon-modal v-if="showCouponDialog" adName="恭喜你获得优惠券礼包" :isVoucher="isVoucher" :adCoupon="adCoupon" :isPayAward="isPayAward" :palId="palId" :osId="palId" recordType="-1"
      :showCouponDialog.sync="showCouponDialog"></coupon-modal>
    <!-- 赠品为知识商品弹窗 -->
    <div class="c-w100 c-h c-pf c-p-t0 c-p-l0 c-p-b0 c-p-r0 c-translucent-balck50 c-pz6" v-show="giftModal" v-if="awardInfo" @click.stop="handleClickCloseModal()">
      <div class="giftDialog c-flex-row c-justify-center">
        <div class="c-fs40 c-fc-reword c-pa c-text-ellipsis1 c-fw600 giftDialog_msg">{{awardInfo.prodType == cfrom.course ? '恭喜您获得学习权限':'恭喜您获得下方的商品'}}</div>
        <div class="c-pa c-ww240 c-hh160 giftDialog_img">
          <img class="c-m-0auto imgCloseBig c-maxh c-h c-object-fit-c" :src="$addXossFilter(awardInfo.cover)" alt="">
        </div>
        <div class="c-pa c-text-ellipsis1 c-fs24 c-fc-xblack giftDialog_name">{{awardInfo.name}}</div>
        <div class="c-pa giftDialog_btn c-flex-row c-flex-center" @click="handleClickSubmit()">{{awardInfo.prodType == cfrom.course ? '查看':'立即领取'}}</div>
        <div class="giftDialog_get c-pa c-fs22 c-text-ellipsis1" v-if="awardInfo.prodType == cfrom.course">您可前往"我的课程"进行查看并学习</div>
      </div>
    </div>
    <footer class="order-fotter c-bg-white c-hh80 c-flex-row c-justify-end c-ph24 c-pv12" v-if="status == 0 || order.prodType == cfrom.activity">
      <div v-if="status == 0" class="c-fs22 c-ww130 c-h c-flex-row c-flex-center c-fc-xblack c-bd1-ccc c-br25 c-ml24" @click="clickCancel">取消订单</div>
      <div v-if="status == 0" class="c-fs22 c-ww130 c-h c-flex-row c-flex-center theme-bg c-fc-white c-br25 c-ml24" @click="clickPay">去支付</div>
      <div v-if="order.prodType == cfrom.activity && order.collageTeamStatus!=1 && (status==1 || (order.prodEnrollInfo.enrollRefundStatus == 1 && order.prodEnrollInfo.refundReason == 1)) " class="c-flex-1 c-fs22 c-h c-flex-row c-flex-center c-fc-xblack c-bd1-ccc c-br25 c-ml24 c-ph24" @click="toTickInfo">查看票券</div>
      <div v-if="order.prodType == cfrom.activity" class="c-flex-1 c-fs22 c-h c-flex-row c-flex-center theme-bg c-fc-white c-br25 c-ml24 c-ph24" @click="toMyActivity">活动报名记录</div>
    </footer>
    <gift-modal :fromProdType="order.prodType" :isFromOrder="true" :orderStatus="status" :showGiftModal="popGift" :prodList="order.giftRelates ? order.giftRelates : []" @closeGift="popGift = false"></gift-modal>
    <recommend-present ref="recommendPresent" from="knowledgeOrderDetail"></recommend-present>
  </div>
</template>

<script>
import { utilJs } from "@/utils/common.js";
import { goDetails } from "@/utils/goDetails.js";
import { BARGAIN_PROD_TYPE_MAP, SALES_PROD_TYPE_MAP, COLLAGE_PROD_TYPE_MAP, GROUP_PURCHASE_PROD_TYPE_MAP } from "@/utils/constant.js";
import VipCustomImg from "@/components/templates/common/VipCustomImg.vue";
import couponModal from "@/components/templates/couponModal.vue";
import giftModal from '@/components/templates/giftModal';
import CustomServiceTmp from '@/components/templates/custService/customServiceTmp.vue';
import recommendPresent from '@/components/templates/recommendPresent';
import { mapState } from "vuex";
let isFromAllOrderList = false; // 判断是否是订单整合列表页面进入
let orderId = "";
export default {
  name: "knowledgeOrderDetail",
  components: {
    VipCustomImg,
    couponModal,
    giftModal,
    CustomServiceTmp,
    recommendPresent
  },
  props: [],
  data() {
    return {
      customPointName: localStorage.getItem("customPointName"),
      theme: localStorage.getItem("colorName") ? localStorage.getItem("colorName") : "mb5_default",
      companyAuth: JSON.parse(localStorage.getItem("companyAuth")),
      cfrom: global.ckFrom,
      mapStatus: {
        '-8': '已关闭',
        '-7': '退款失败',
        "-6": "已退款",
        '-5': '已关闭',
        "-4": "删除订单",
        "-3": "已退款", // 签到后退款
        "-2": "取消订单",
        "-1": "支付失败",
        "0": '待付款',
        "1": '交易成功',
        "-9": '欠费中'
      },
      orderInfo: [],
      order: {},
      isShowTips: false,
      status: '',
      filterMoney: '',
      salesMap: Object.freeze(SALES_PROD_TYPE_MAP),
      bargainMap: Object.freeze(BARGAIN_PROD_TYPE_MAP),
      collageMap: Object.freeze(COLLAGE_PROD_TYPE_MAP),
      groupPurchaseMap: Object.freeze(GROUP_PURCHASE_PROD_TYPE_MAP),
      typeMap: global.prodMapType,
      payAward: null, //支付有礼信息
      giftModal: false,
      awardInfo: null,
      palId: '',
      adCoupon: [],
      isVoucher: false,
      showCouponDialog: false,
      isPayAward: false, //判断当前为支付有礼的优惠卷
      protocolInfo: null,
      popGift: false, //赠送礼包
      isCustServiceOpen: localStorage.getItem("isCustServiceOpen") == 1 ? true : false, // 是否开启小程序客服
      spec: null,
      collocationArr: [],
      collocationTotalPrice: 0,
      wxCreditPayTimes: 0,
      wxCreditPayLastTimes: 0,
      showCollocationProds: true,
    };
  },
  computed: {
    ...mapState({
      allOrderList: state => state.oem_store.allOrderList,
    }),
  },
  created() {
    utilJs.appShare(this);
  },
  beforeRouteEnter(to, from, next) {
    next(vm => {
      // 订单超过24小时未支付会生成新订单，此时要替换详情、列表的orderId，否则返回会报错
      if ((from.path == '/homePage/course/coursePay' || from.path == '/homePage/payPolitely/payPolitely') && sessionStorage.getItem('orderMergeId')) {
        let orderMergeId = sessionStorage.getItem('orderMergeId');
        vm.setOrderListAttribute(vm.$route.query.orderId, 'orderId', orderMergeId);
        sessionStorage.removeItem('orderMerge');
        vm.$routerGo(vm, "replace", { path: '/member/myOrder/knowledgeOrderDetail', query: { orderId: orderMergeId, tabIndex: vm.$route.query.tabIndex } });
      } else if (from.path == '/member/myOrder/allOrderList') {
        isFromAllOrderList = true;
      }
    });
  },
  beforeRouteLeave(to, from, next) {
    this.$cjConfirm.hide();
    next()
  },

  methods: {
    isShowGift() {
      // 有礼包 && 没有全部废弃（isDeprecated true票券全废弃）&& (status:  1交易成功 || -3 签到退款也需要展示礼包)
      return (this.order.giftRelates && this.order.giftRelates.length > 0) && !this.order.isDeprecated && (this.status == -3 || this.status == 1)
    },
    // 票券信息
    toTickInfo() {
      // 点击查看票券
      this.$routerGo(this, "push", {
        path: `/activity/myTicket`,
        query: {
          activityId: this.order.prodEnrollInfo.activityId,
          identCode: this.order.prodEnrollInfo.identCode,
          asId: 0
        }
      });
    },
    // 活动报名记录
    toMyActivity() {
      this.$routerGo(this, "push", {
        path: `/member/myActivity/myActivity`,
      });
    },
    // 打开推荐有礼弹框
    openReCommendPresent() {
      this.$refs.recommendPresent.completetRecommendTask({
        relateId: this.order.extId,
        orderId: this.order.orderId
      }); // 调用子组件方法
    },
    popGiftModal() {
      if (this.order.prodType == 7) { // 活动直接跳到我的票券页面
        this.toTickInfo()
        return
      }
      this.popGift = true;
    },
    clickProtocol(item) {
      this.$routerGo(this, "push", { path: `/homePage/agent/protocolInfo`, query: { protocolId: item.protocolId } });
    },
    //企业团购票券
    goGroupPurchaseTicket(gOrderId) {
      this.$routerGo(this, "push", { path: '/homePage/groupPurchase/groupPurchaseMyTicket', query: { orderId: gOrderId } });
    },
    handleClickSubmit() {
      if (this.awardInfo.prodType == this.cfrom.course) {
        this.$routerGo(this, "replace", { path: "/member/myInterest/interestIndex" });
      } else {
        this.getShopInfo(this.awardInfo.prodId, this.palId)
      }
    },
    getShopInfo(prodId, palId) {
      utilJs.getMethod(
        global.apiurl + "goods/goodsDetail?mgId=" + prodId + "&palId=" + palId,
        res => {
          this.shopInfo = res.goods;
          this.freeShipping = res.freeShipping;
          this.payAwardData = res.payAwardData;
          let shopInfo = [
            {
              mgId: this.shopInfo.mgId,
              mcId: "",
              avatar: this.shopInfo.avatar ? this.shopInfo.avatar : "",
              pointsDeduct: 0,
              name: this.shopInfo.name,
              price: this.payAwardData.price,
              originalPrice: this.shopInfo.originalPrice,
              quantity: 1,
              shopSpecInfo: "",
              gsiiId: "",
              postage: this.shopInfo.postage,
              isMail: this.shopInfo.isMail,
              isMallExpressDeliver: this.shopInfo.isMallExpressDeliver,
              isMallOfflineDeliver: this.shopInfo.isMallOfflineDeliver,
              stock: 1,
              salesStock: "",
              collageStock: "",
              freeShipping: this.freeShipping,
              isFlashSales: false,
              isCollage: false,
              pId: "",
              noLimit: false,
              vipDiscount: this.shopInfo.vipDiscount,
              svipDiscount: this.shopInfo.svipDiscount,
              agentDiscount: this.shopInfo.agentDiscount,
              partnerDiscount: this.shopInfo.partnerDiscount,
              branchDiscount: this.shopInfo.branchDiscount,
              isPayAward: true,
              limitType: -1,
              limitNumber: 0,
              purchasedNum: 0,
              vipDiscountType: this.shopInfo.vipDiscountType || 1,
            }
          ];
          if (this.shopInfo.valuationMethod && this.shopInfo.valuationMethod == 2 && this.shopInfo.freightMode == 1) {
            shopInfo.valuationMethod = this.shopInfo.valuationMethod;
          }
          sessionStorage.setItem("shopBuyInfo", JSON.stringify(shopInfo));
          let goPath = "/mall/shopSettlement/shopSettlement?shopNo=" + prodId + "&palId=" + palId;
          this.$routerGo(this, "push", {
            path: goPath
          });
        }
      );
    },
    // 获取优惠卷信息
    receivePayAward(payAward) {
      utilJs.postMethod(global.apiurl + `activity/payAward/receivePayAward`, {
        orderId: payAward.orderId,
        md5Key: payAward.md5Key,
        ppId: payAward.ppId,
        paId: payAward.paId
      }, res => {
        this.awardInfo = res.awardInfo;
        this.palId = res.palId;
        if (res.awardType == 1) {
          this.isPayAward = true;
          this.adCoupon = res.redeemDataList.filter(i => i.couponStatus == 0);
          this.isVoucher = res.redeemDataList.some(item => {
            if (item.couponSource == 2) {
              return true;
            }
          })
          this.adCoupon.forEach(ele => {
            ele.startAt = ele.startAt ? ele.startAt.split(' ')[0].replace(/-/g, '.') : ''
            ele.endAt = ele.endAt ? ele.endAt.split(' ')[0].replace(/-/g, '.') : ''
          })
          this.showCouponDialog = true;
          return;
        }
        if (res.awardType == 2) {
          this.giftModal = true;
        } else {
          // 活动
          let goPath = res.awardInfo.url.match(/#(\S*)/)[1];
          this.$routerGo(this, "push", {
            path: goPath
          });
        }
      }, failes => {
        window.location.reload();
      })
    },
    handleClickpayAward() {
      if (this.payAward != null) {
        this.receivePayAward(this.payAward);
      }
      if (isFromAllOrderList) {
        let operactionInfo = {
          orderId: orderId,
          operaction: 'payAward'
        }
        this.partUpateOrder(operactionInfo);
      }
    },
    handleClickCloseModal() {
      this.giftModal = false;
    },
    formatDecimal(num, decimal) {
      //decimal 小数点后保留几位数
      num = num.toString()
      let index = num.indexOf('.')
      if (index !== -1) {
        num = num.substring(0, decimal + index + 1)
      } else {
        num = num.substring(0)
      }
      return num;
    },
    getKnowledgeOrder() {
      utilJs.getMethod(global.apiurl + "orders/getOrderDetail?orderId=" + orderId, res => {
        if (res.spec) {
          res.spec.tit = this._getDataTypeMap(res.spec.type, res.spec.val);
        }
        this.status = res.status;
        this.order = res;
        this.filterMoney = `<div><span class="c-fs28">${res.payMoney.split(".")[0]}</span>.<span>${res.payMoney.split(".")[1]}</span></div>`
        this.orderInfo = res.orderInfo;
        this.payAward = res.payAward;
        this.protocolInfo = res.protocolInfo && res.protocolInfo.length > 0 ? res.protocolInfo : null;
        if (res.paymentMethod == 17 && res.plan_details && res.plan_details.length > 0) {
          let hasPayArr = res.plan_details.filter((item) => {
            return item.service_order_state == 'DONE'
          })
          this.wxCreditPayTimes = hasPayArr.length; //已支付次数
          this.wxCreditPayLastTimes = res.plan_details.length - this.wxCreditPayTimes; //未支付次数
        }
        if (res.prodType == this.cfrom.collocationBuy) {
          if (res.status == 0 && res.comboType == 1) {
            for (let i = 0; i < res.subOrder.length; i++) {
              this.collocationArr = [...this.collocationArr, ...res.subOrder[i].prods]
            }
          } else {
            this.collocationArr = res.subOrder;
          }
          for (let i = 0; i < this.collocationArr.length; i++) {
            this.collocationTotalPrice += Number(this.collocationArr[i].price || this.collocationArr[i].prodPrice) * Number(this.collocationArr[i].prodNum);
          }
        }
        if (this.$route.query.exchangeGoods == 1 && this.order.giftRelates && this.order.giftRelates.length > 0) {
          this.$nextTick(() => {
            this.popGiftModal();
          })
        }
      })
    },
    //获取对应的天数 1=天；2=月；3=年；4=永久
    _getDataTypeMap(type, numer) {
      let text = '';
      switch (type * 1) {
        case 1:
          text = `${numer}天`;
          break;
        case 2:
          text = `${numer}月`;
          break;
        case 3:
          text = `${numer}年`;
          break;
        case 4:
          text = '永久';
          break;
        default:
          text = '';
      }
      return text;
    },
    copyText(id) {
      utilJs.copyText(id);
    },
    clickCancel() {
      let that = this;
      this.$cjConfirm({
        title: '提示',
        titleCenter: true,
        message: '确定取消订单?',
        messageCenter: true,
        showMasker: true,
        clickCloseModal: false,
        showCancelButton: true,
        cancelButtonText: '取消',
        confirmButtonText: '确定',
        onConfirm() {
          that.cancelOrder()
        },
        onCancel() {
        },
      })
    },
    // 点击确定取消订单
    cancelOrder() {
      utilJs.postMethod(global.apiurl + "orders/orderCancel", { orderId: orderId }, res => {
        let $this = this;
        if (res == "OK") {
          this.$showCjToast({
            text: "取消成功",
            type: "success",
          }).then(() => {
            let operactionInfo = {
              orderId: orderId,
              operaction: 'cancelOrder'
            }
            $this.partUpateOrder(operactionInfo);
            $this.$nextTick(() => {
              $this.$router.go(-1);
            })
          });
        }
      });
    },
    clickCollocationItem(tItem) {
      let courseType = tItem.subProdType ? (tItem.subProdType == 112 ? 2 : tItem.subProdType == 111 ? 1 : 0) : tItem.courseType
      let prodType = tItem.prodType == 201 ? 75 : tItem.prodType
      console.log(11111111111)
      goDetails(this, prodType, tItem.prodId, {}, courseType);
    },
    clickOrderItem() {
      //点击订单 prodType 2升级vip，4升级svip，22购买vip2，38专栏兑换码
      let type = this.order.prodType;
      if ( type == 7 && this.order.prodEnrollInfo && this.order.prodEnrollInfo.length == 0) {
        return true
      }
      if (type == 116) {
        if (this.order.jwFlag == 1) {
          this.$cjConfirm({
            title: '提示',
            message: "该订单已换课,现已无权访问",
            showCancelButton: false,
            clickCloseModal: false
          })
          return true;
        }
        if (this.status == 1) {
          //付款并且学员和用户是绑定,才支持跳转面授课详情页
          utilJs.postMethod(global.apiurl + "educationSystem/isUserBindStudent", { studentId: this.order.extId1 }, res => {
            this.$routerGo(this, "push", {
              path: "/edu/courseDetail",
              query: {
                orderNo: this.order.orderNo,
                saleCourseId: this.order.prodId,
                studentId: this.order.extId1,
              }
            })
          })
        } else if (this.status == -3 || this.status == -6) {
          this.$cjConfirm({
            title: '提示',
            message: "已退款,现已无权访问",
            showCancelButton: false,
            clickCloseModal: false
          })
        }
      } else {
        if (((type == 15 || type == 17) && this.status == -3) || type == 138) { //付费问答、围观问答
          return;
        }
        type = type == 201 ? global.ckFrom.mutuaTest : type == 15 ? global.ckFrom.circusee : type == 2 || type == 4 || type == 22 ? global.ckFrom.vip : type
        let prodId = type == 7 ? this.order.prodEnrollInfo.activityId : type == 15 || type == 17 ? this.order.questionDetailId : type == 38 || type == 91 || type == 5000 ? this.order.extId : this.order.prodId
        let query = {}
        if (type == 68 || type == 69) { //vip拼团
          query.isSales = true;
        }
        console.log('type, prodId, query, this.order.courseType', type, prodId, query, this.order.courseType)
        goDetails(this, type, prodId, query, this.order.courseType);
      }
    },
    // 局部更新订单详情页面数据
    partUpateOrder(operactionInfo) {
      if (operactionInfo == null) {
        return
      }
      if (operactionInfo.operaction == 'cancelOrder') {
        // 取消订单
        this.setOrderListAttribute(operactionInfo.orderId, 'status', -5);
        this.filterOrderList(operactionInfo.orderId);
      } else if (operactionInfo.operaction == 'payAward') {
        this.setOrderListAttribute(operactionInfo.orderId, 'payAward', null);
      }
    },
    // 设置订单的属性
    setOrderListAttribute(orderId, name, value) {
      let allOrderList = this.allOrderList;
      allOrderList.forEach((item, index) => {
        if (item.orderId == orderId) {
          this.$set(allOrderList[index], name, value)
        }
      })
      this.$store.commit('updateAllOrderList', allOrderList);
    },
    // 过滤订单
    filterOrderList(id) {
      let allOrderList = this.allOrderList;
      let list = allOrderList.filter(item => item.orderId != id);
      sessionStorage.setItem('filterOrder', true);
      this.$store.commit('updateAllOrderList', list);
    },
    clickPay() {
      // 判断体验版是否到期，到期之后不可购买商品
      if (utilJs.alertShopExpire(this, utilJs.getTimeByDate(this.companyAuth.expireTime))) return true;
      if (!utilJs.isOpenIosGzhPay(this.order.prodType)) {
        this.$store.commit('updateShowVitualModal', true);
        return;
      }
      switch (this.order.prodType) {
        case 1:
        case 2:
        case 3:
        case 4:
        case 22:
        case 23:
        case 27:
        case 28:
        case 73:
        case 74:
          let queryObj = '';
          if (this.order.tags == '4096') {
            // 判断当前是砍价购得vip跳转携带参数
            queryObj = {
              prodId: this.order.prodId,
              type: this.order.prodType,
              attendId: this.order.extId,
              orderId: this.order.orderId,
              tabIndex: this.$route.query.tabIndex
            }
          } else if (this.order.tags == '4194304') {
            queryObj = {
              prodId: this.order.prodId,
              type: this.order.prodType,
              orderId: this.order.orderId,
              tabIndex: this.$route.query.tabIndex,
              recRelateId: this.order.extId,
              recType: 3
            }
          } else if ((this.order.tags & 1048576) == 1048576) {
            queryObj = {
              type: this.order.prodType,
              prodId: this.order.prodId,
              orderId: this.order.orderId,
              isFrom: 4,
              isFromGroupOrder: true,
              quantity: this.order.quantity
            };
          } else {
            queryObj = {
              type: this.order.prodType,
              prodId: this.order.prodId,
              pId: this.order.extId,
              orderId: this.order.orderId,
              isFrom: 0,
              tabIndex: this.$route.query.tabIndex
            };
          }
          this.$routerGo(this, "push", {
            path: "/member/vip/vipBuy",
            query: queryObj
          });
          break;
        // 训练营
        case 78:
          this.$routerGo(this, "push", {
            path: "/homePage/course/coursePay",
            query: {
              cId: -1,
              extId: this.order.prodId,
              ckFrom: this.order.prodType,
              isFromInvite: 0,
              isFromOrder: "TRUE",
              attendId: this.order.tags == '4096' ? this.order.extId : '',
              recRelateId: this.order.tags == '4194304' ? this.order.extId : '',
              recType: this.order.tags == '4194304' ? 3 : '',
              orderId: this.order.orderId,
              tabIndex: this.$route.query.tabIndex
            }
          });
          break;
        case 5:
        case 25:
          let pathQuery = {
            cId: this.order.prodId,
            courseType: this.order.courseType,
            extId: -1,
            ckFrom: this.order.prodType, // 活动进入支付页面
            isFromInvite: this.order.isDeductedByInvitationCard,
            isFromOrder: "TRUE",
            attendId: this.order.tags == '4096' ? this.order.extId : '',
            recRelateId: this.order.tags == '4194304' ? this.order.extId : '',
            recType: this.order.tags == '4194304' ? 3 : '',
            orderId: this.order.orderId,
            tabIndex: this.$route.query.tabIndex
          }
          if ((this.order.tags & 1048576) == 1048576) { //企业团购
            pathQuery.isGroupPurchase = true;
            pathQuery.groupSelectNum = this.order.quantity;
            pathQuery.groupPurchaseId = this.order.extId;
          }
          this.$routerGo(this, "push", {
            path: "/homePage/course/coursePay",
            query: pathQuery
          });
          break;
        case 66:
          this.$routerGo(this, "push", {
            path: "/homePage/course/coursePay",
            query: {
              cId: this.order.prodId,
              extId: -1,
              ckFrom: this.order.prodType, // 活动进入支付页面
              isFromInvite: this.order.isDeductedByInvitationCard,
              isFromOrder: "TRUE",
              pId: this.order.extId,
              orderId: this.order.orderId,
              tabIndex: this.$route.query.tabIndex
            }
          });
          break;
        case 29:
        case 30:
        case 104:
          this.$routerGo(this, "push", {
            path: "/homePage/course/coursePay",
            query: {
              cId: this.order.extId,
              extId: this.order.collageId,
              ckFrom: this.order.prodType, // 活动进入支付页面
              isFromInvite: 0,
              isFromOrder: "TRUE",
              prodId: this.order.prodId,
              orderId: this.order.orderId,
              tabIndex: this.$route.query.tabIndex
            }
          });
          break;
        case 51:
        case 41:
        case 115:
        case 180:
          this.$routerGo(this, "push", {
            path: "/homePage/course/coursePay",
            query: {
              cId: -1,
              extId: this.order.prodId,
              ckFrom: this.order.prodType, // 活动进入支付页面
              isFromInvite: 0,
              attendId: this.order.tags == '4096' ? this.order.extId : '',
              recRelateId: this.order.tags == '4194304' ? this.order.extId : '',
              recType: this.order.tags == '4194304' ? 3 : '',
              orderId: this.order.orderId,
              tabIndex: this.$route.query.tabIndex
            }
          });
          break;
        case 7:
          let queryAc = {
            cId: -1,
            selectNum: this.order.quantity,
            activityId: this.order.prodEnrollInfo.activityId,
            extId: this.order.prodId,
            ckFrom: this.order.prodType, // 活动进入支付页面
            isFromInvite: this.order.prodType == 9 ? this.order.isDeductedByInvitationCard : 0,
            isFromOrder: "TRUE",
            attendId: this.order.tags == '4096' ? this.order.extId : '',
            recRelateId: this.order.tags == '4194304' ? this.order.extId : '',
            recType: this.order.tags == '4194304' ? 3 : '',
            orderId: this.order.orderId,
            tabIndex: this.type
          }
          if (this.order.mtkType == 1) {
            queryAc.pId = this.order.extId;
          }
          if ((this.order.tags & 1048576) == 1048576) { //企业团购
            queryAc.isGroupPurchase = true;
            queryAc.groupSelectNum = this.order.quantity;
            queryAc.groupPurchaseId = this.order.extId;
          }
          this.$routerGo(this, "push", {
            path: "/homePage/course/coursePay",
            query: queryAc
          });
          break;
        case 6:
        case 8:
        case 9:
        case 10:
        case 11:
        case 26:
        case 56:
        case 61:
        case 62:
        case 75:
        case 77:
        case 103:
          let queryT = {
            cId: -1,
            extId: this.order.prodId,
            ckFrom: this.order.prodType, // 活动进入支付页面
            isFromInvite: this.order.prodType == 9 ? this.order.isDeductedByInvitationCard : 0,
            isFromOrder: "TRUE",
            attendId: this.order.tags == '4096' ? this.order.extId : '',
            recRelateId: this.order.tags == '4194304' ? this.order.extId : '',
            recType: this.order.tags == '4194304' ? 3 : '',
            orderId: this.order.orderId,
            tabIndex: this.$route.query.tabIndex
          }
          if ((this.order.tags & 1048576) == 1048576) { //企业团购
            queryT.isGroupPurchase = true;
            queryT.groupSelectNum = this.order.quantity;
            queryT.groupPurchaseId = this.order.extId;
          }
          this.$routerGo(this, "push", {
            path: "/homePage/course/coursePay",
            query: queryT
          });
          break;
        case 67:
        case 70:
        case 71:
        case 72:
        case 8075:
        case 8076:
        case 8077:
        case 8078:
        case 8079:
        case 8080:
        case 8083:
        case 8084:
          this.$routerGo(this, "push", {
            path: "/homePage/course/coursePay",
            query: {
              cId: -1,
              extId: this.order.prodId,
              ckFrom: this.order.prodType, // 活动进入支付页面
              isFromInvite: 0,
              isFromOrder: "TRUE",
              pId: this.order.extId,
              orderId: this.order.orderId,
              tabIndex: this.$route.query.tabIndex
            }
          });
          break;
        case 15:
        case 17:
          this.$routerGo(this, "push", {
            path: "/homePage/course/coursePay",
            query: {
              cId: -1,
              extId: this.order.prodId,
              ckFrom: this.order.prodType, // 问答进入支付页面
              isFromInvite: 0,
              isFromOrder: "TRUE",
              orderId: this.order.orderId,
              tabIndex: this.$route.query.tabIndex
            }
          });
          break;
        case 68:
        case 69:
          this.$routerGo(this, "push", {
            path: "/member/vip/vipBuy",
            query: {
              type: this.order.prodType,
              prodId: this.order.prodId,
              pId: this.order.extId,
              orderId: this.order.orderId,
              tabIndex: this.$route.query.tabIndex
            }
          });
          break;
        case 116:
          this.$routerGo(this, "push", {
            path: "/homePage/course/coursePay",
            query: {
              cId: -1,
              extId: this.order.prodId,
              ckFrom: this.order.prodType,
              jwSaleCourseSpecId: this.order.extId,
              studentId: this.order.extId1,
              orderId: this.order.orderId,
              tabIndex: this.$route.query.tabIndex
            }
          });
          break;
        case 8082:
          this.$routerGo(this, "push", {
            path: "/homePage/course/coursePay",
            query: {
              cId: -1,
              extId: this.order.prodId,
              ckFrom: this.order.prodType,
              jwSaleCourseSpecId: this.order.extId,
              studentId: this.order.extId1,
              pId: this.order.jwMarketingId,
              orderId: this.order.orderId,
              tabIndex: this.$route.query.tabIndex
            }
          });
          break;
        case 129:
        case 125:
          this.$routerGo(this, "push", {
            path: "/homePage/course/coursePay",
            query: {
              extId: this.order.prodId,
              ckFrom: this.order.prodType,
              isFromInvite: 0,
              cId: -1,
              isFromOrder: "TRUE",
              pId: this.order.tags == 8 || this.order.tags == 12 ? this.order.extId : '',
              attendId: this.order.tags == '4096' ? this.order.extId : '',
              orderId: this.order.orderId,
              tabIndex: this.$route.query.tabIndex
            }
          });
          break;
        case 142:
        case 145:
        case 146:
          this.$routerGo(this, "push", {
            path: "/homePage/course/coursePay",
            query: {
              cId: 0,
              extId: this.order.tags == '4096' ? this.order.prodId : this.order.extId,
              ckFrom: this.order.prodType,
              extraId: 0,
              attendId: this.order.tags == '4096' ? this.order.extId : '',
              orderId: this.order.orderId,
              tabIndex: this.$route.query.tabIndex
            }
          })
          break;
        case 181:
        case 185:
        case 5000:
          let query = {
            cId: 0,
            extId: this.order.extId,
            ckFrom: this.order.prodType,
            orderId: this.order.orderId,
            tabIndex: this.$route.query.tabIndex
          }
          if (this.order.spec) {
            query.circleSpecDateType = this.order.spec.type;
            query.circleSpecDateVal = this.order.spec.val;
          }
          this.$routerGo(this, "push", {
            path: "/homePage/course/coursePay",
            query: query
          })
          break;
        case 190:
          this.$routerGo(this, "push", {
            path: "/homePage/course/coursePay",
            query: {
              cId: this.order.prodId || 0,
              extId: 0,
              ckFrom: this.order.prodType,
              orderId: this.order.orderId,
              tabIndex: this.$route.query.tabIndex
            }
          })
          break;
        case 200:
          this.$routerGo(this, "push", {
            path: "/homePage/course/coursePay",
            query: {
              cId: -1,
              extId: this.order.prodId,
              ckFrom: this.order.prodType,
              rcdId: !!this.order.rcdId ? this.order.rcdId : '',
              number: 1,
            }
          });
          break;
        case 197:
          if (this.order.specType == 2) {
            let multipleTmp = {
              name: this.order.specName,
              id: this.order.extId,
              prods: this.order.subOrder
            }
            localStorage.setItem("collocationProds", JSON.stringify(multipleTmp));
          } else {
            localStorage.setItem("collocationProds", JSON.stringify(this.order.subOrder));
          }
          let queryData = {
            cId: -1,
            extId: this.order.prodId,
            ckFrom: this.order.prodType,
            orderId: this.order.orderId,
            tabIndex: this.$route.query.tabIndex,
            comboType: this.order.comboType,
            isFromOrder: "TRUE",
          }
          if (this.order.specType == 2) {
            queryData.isMultiple = 1
          }
          this.$routerGo(this, "push", {
            path: "/homePage/course/coursePay",
            query: queryData
          })
          break;
      }
    },
    //分享
    wechatShare: function () {
      let title = "我的订单";
      let shareUrl = window.location.href.split("#")[0] + "#/member/myOrder/allOrderList?refereeId=" + localStorage.getItem("userId");
      utilJs.wechatConfig(shareUrl, title, "", "", function () { });
    },
    //手机端分享
    appShare: function () {
      let title = "我的订单";
      let shareUrl = window.location.href.split("#")[0] + "#/member/myOrder/allOrderList?refereeId=" + localStorage.getItem("userId");
      utilJs.appShareTrue(title, "", shareUrl, "");
    }
  },
  mounted() {
    setDocumentTitle("订单详情");// eslint-disable-line
    orderId = this.$route.query.orderId || "";
    this.status = '';
    this.filterMoney = '';
    this.orderInfo = [];
    this.isShowTips = false;
    this.orderNo = {};
    this.popGift = false;
    this.collocationArr = [];
    this.collocationTotalPrice = 0;
    this.wxCreditPayTimes = 0;
    this.wxCreditPayLastTimes = 0;
    this.showCollocationProds = true;
    this.typeMap = JSON.parse(JSON.stringify(global.prodMapType));
    this.typeMap[global.ckFrom.qa] = localStorage.getItem("questionCustom") == 1 ? "预约专区" : "付费问答";
    this.typeMap[global.ckFrom.answer] = localStorage.getItem("questionCustom") == 1 ? "预约专区" : "付费问答";
    this.typeMap[global.ckFrom.circusee] = localStorage.getItem("questionCustom") == 1 ? "围观预约" : "围观问题";
    this.typeMap[global.ckFrom.agentApply] = JSON.parse(localStorage.getItem("customName")).agentName;
    this.typeMap[global.ckFrom.partnerApply] = JSON.parse(localStorage.getItem("customName")).partnerName;
    this.typeMap[global.ckFrom.branchApply] = JSON.parse(localStorage.getItem("customName")).branchName;
    this.typeMap[global.ckFrom.cooApply] = JSON.parse(localStorage.getItem("customName")).cooName;
    this.typeMap[global.ckFrom.agencyApply] = JSON.parse(localStorage.getItem("customName")).agencyName;
    this.typeMap[global.ckFrom.agent6Apply] = JSON.parse(localStorage.getItem("customName")).agent6Name;
    this.typeMap[global.ckFrom.agent7Apply] = JSON.parse(localStorage.getItem("customName")).agent7Name;
    this.typeMap[global.ckFrom.agent8Apply] = JSON.parse(localStorage.getItem("customName")).agent8Name;
    this.typeMap[global.ckFrom.agent9Apply] = JSON.parse(localStorage.getItem("customName")).agent9Name;
    utilJs.getGiftCardInfo().then(res => {
      this.typeMap[global.ckFrom.giftCard] = res.name || '虚拟币';
    })
    this.getKnowledgeOrder();
    this.wechatShare();
  },
};
</script>

<!-- Add "scoped" attribute to limit CSS to this component only -->

<style scoped lang="less">
.bgTop {
  background-image: url("../../../assets/i/orderBg.png");
  height: 100%;
  width: 100%;
  background-position: top center;
  background-repeat: no-repeat;
  padding: 0.85rem 0.6rem;
}
.order-fotter {
  width: 100%;
  max-width: 16rem;
  border: 1px solid rgba(242, 242, 242, 1);
  box-shadow: 0px -6px 3px 0px rgba(132, 132, 132, 0.03);
  position: fixed;
  margin: 0 auto;
  left: 0;
  right: 0;
  bottom: 0;
}
.bg-f4f7f9 {
  background-color: #f4f7f9;
}
.my-ticket {
  color: #ff9458;
  background-color: rgba(255, 135, 130, 0.2);
}
.bg-deepGreen{
  background-color: #23DB85;
}
.bd-l2-sgray {
  border-left: 2px solid #F5F7FA;
}
.bd-l2-theme {
  border-left: 2px solid var(--mb7color);
}
.p-14 {
  left: -0.35rem;
}
.giftDialog {
  position: relative;
  top: 50%;
  left: 50%;
  width: 15.9rem;
  height: 19.475rem;
  margin-top: -9.7375rem;
  transform: translateX(-50%);
  background: url("https://kposshzcdn.ckjr001.com/admin/material/9_material_admin/image/assets/i/wap/payPolitely/giftDialog_bg.png")
    no-repeat center center;
  background-size: contain;
  .giftDialog_msg {
    top: 3.65rem;
    left: 50%;
    transform: translateX(-50%);
  }
  .giftDialog_img {
    top: 6.25rem;
    left: 50%;
    transform: translateX(-50%);
    overflow: hidden;
  }
  .giftDialog_name {
    top: 10.75rem;
    left: 50%;
    transform: translateX(-50%);
  }
  .giftDialog_btn {
    width: 10.5rem;
    height: 1.9rem;
    top: 14.1rem;
    left: 50%;
    transform: translateX(-50%);
    background: url("../../../assets/i/wap/payPolitely/giftDialog_btn.png")
      no-repeat center center;
    background-size: contain;
    color: #f95f40;
    font-size: 0.7rem;
  }
  .giftDialog_get {
    bottom: 2.2rem;
    left: 50%;
    transform: translateX(-50%);
    color: #fff;
  }
}
</style>
